package com.teziyou.test;

import java.util.HashMap;
import java.util.Map;

import com.mytravel.commodityBridge.pool.ConnectionManager;
import com.mytravel.commodityBridge.pool.ConnectionProviderImpl;
import com.mytravel.commodityBridge.proxy.ThriftClientProxy;
import com.mytravel.commodityBridge.service.ScenicSpotInfoService;

public class ScenicSpotThriftClient {
	public static void main(String[] args) throws Exception {
		//218.240.21.155
		//127.0.0.1
		String serviceURL = "218.240.21.155:7911";
//		String serviceURL = "127.0.0.1:7911";
		ConnectionProviderImpl connectionProvider = new ConnectionProviderImpl();
		connectionProvider.setServiceURL(serviceURL);
		connectionProvider.setConnTimeout(12000);
		connectionProvider.afterPropertiesSet();
		
		ConnectionManager connectionManager = new ConnectionManager();
		connectionManager.setConnectionProvider(connectionProvider);
		
		ThriftClientProxy tcp = new ThriftClientProxy();
		tcp.setConnectionManager(connectionManager);
		
		ScenicSpotInfoService.Client obj = tcp.getScenicSpotInfoServiceClient();
		//根据id获取景区信息
//		Map<String,String> map = obj.findSceneById(10007l);
//		System.out.println(map.toString());
		
//		ScenicSpot scenicSpot = new ScenicSpot();
//		scenicSpot.setIsok(0);
//		scenicSpot.setName("动物园测试添加");
//		//添加景区
//		obj.addScene(scenicSpot);
		//编辑景区
//		scenicSpot.setScenicId(10007l);
//		scenicSpot.setName("动物园测试");
//		obj.updateScene(scenicSpot);
//		Map<String,String> map =new  HashMap<>();
//		int i =obj.findScenesCount(map);
//		System.out.println(i);
//		map.put(SystemStaticUtil.PAGE_NUM, "1");
//		map.put(SystemStaticUtil.PAGE_SIZE, "2");
		Map<String, String> map = new HashMap<>();
		map.put("name", "%欢%");
		String str = obj.findScenesByPage(map);
		System.out.println(str);
//		String str = obj.findSceneById(10008l);
//		System.out.println(str);
	}
}
